93d61115c129fbbf8b84d7598347e869456986cf,java/sigProc/ContinuousClassifier.java,ContinuousClassifier,mainloop,#,247
Before Change
// Logging stuff when nothing is happening
if (System.currentTimeMillis() - t0 > 5000) {
System.out.println( String.format("%5.3f seconds, %d samples, %d events", System.currentTimeMillis() / 1000.,
status.nSamples, status.nEvents));
t0 = System.currentTimeMillis();
}
// Process any new data
After Change
int nOut=classifiers.get(0).getOutputSize()-1; nOut=nOut>0?nOut:1;
Matrix dv = null;
boolean endEvent = false;
long t0 = System.currentTimeMillis();
long t=t0;
long pnext=t+printInterval_ms;
// Run the code
while (!endEvent && run) {//The run switch allows control of stopping the thread and getting out of the loop
// Getting data from buffer
SamplesEventsCount status = null;
// Block until there are new events
try {
if ( VERB>0 ) {
System.out.println(TAG+ " Waiting for " + (nSamples + trialLength_samp + 1) + " samples");
}
status = C.waitForSamples(nSamples + trialLength_samp + 1, this.timeout_ms);
} catch (IOException e) {
e.printStackTrace();
}
if (status.nSamples < header.nSamples) {
System.out.println(TAG+ " Buffer restart detected");
nSamples = status.nSamples;
dv = null;
continue;
}
// Logging stuff when nothing is happening
t = System.currentTimeMillis();
if ( t > pnext ) {
System.out.println( TAG+ String.format("%d %d %5.3f (samp,event,sec)\r",
status.nSamples,status.nEvents,(t-t0)/1000.0));
pnext = t+printInterval_ms;